@(content: String, commentId: Int,
  repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
<span id="error-edit-content-@commentId" class="error"></span>
@gitbucket.core.helper.html.preview(
  repository         = repository,
  content            = content,
  enableWikiLink     = false,
  enableRefsLink     = true,
  enableLineBreaks   = true,
  enableTaskList     = true,
  hasWritePermission = true,
  completionContext  = "issues",
  style              = "",
  elastic            = true,
  focus              = true,
  tabIndex           = 1
)
<div class="pull-right">
  <input type="button" id="cancel-comment-@commentId" class="btn btn-default" value="Cancel"/>
  <input type="button" id="update-comment-@commentId" class="btn btn-success" value="Update comment"/>
</div>
<script>
$(function(){
  var callback = function(data){
    $('#update-comment-@commentId, #cancel-comment-@commentId').removeAttr('disabled');
    $('#commentContent-@commentId').empty().html(data.content);
    prettyPrint();
  };

  $('#update-comment-@commentId').click(function(){
    var content = $(this).parent().parent().find('textarea[name=content]').val();
    $('#update-comment-@commentId, #cancel-comment-@commentId').attr('disabled', 'disabled');
    $.ajax({
      url: '@context.path/@repository.owner/@repository.name/issue_comments/edit/@commentId',
      type: 'POST',
      data: {
        issueId : 0,	// TODO
        content : content
      }
    }).done(
      callback
    ).fail(function(req) {
      $('#update-comment-@commentId, #cancel-comment-@commentId').removeAttr('disabled');
      $('#error-edit-content-@commentId').text($.parseJSON(req.responseText).content);
    });
  });

  $('#cancel-comment-@commentId').click(function(){
    $('#update-comment-@commentId, #cancel-comment-@commentId').attr('disabled', 'disabled');
    $.get('@context.path/@repository.owner/@repository.name/issue_comments/_data/@commentId', callback);
    return false;
  });
});
</script>
